package com.innodata.riskEngine.common.pojo;

import java.io.Serializable;
import java.util.Objects;

/**
 * @Author: liboshuai
 * @Date: 2023-10-24 21:32
 **/
public class RuleCdcPO implements Serializable {
    private static final long serialVersionUID = -8377862841164083597L;
    /**
     * 库名、表名
     */
    private CdcSource source;
    /**
     * 之前的数据
     */
    private RulePO before;
    /**
     * 之后的数据
     */
    private RulePO after;
    /**
     * 操作类型：r-查询；u-更新；d-删除；c-创建
     */
    private String op;

    // setter and getter

    public CdcSource getSource() {
        return source;
    }

    public void setSource(CdcSource source) {
        this.source = source;
    }

    public RulePO getBefore() {
        return before;
    }

    public void setBefore(RulePO before) {
        this.before = before;
    }

    public RulePO getAfter() {
        return after;
    }

    public void setAfter(RulePO after) {
        this.after = after;
    }

    public String getOp() {
        return op;
    }

    public void setOp(String op) {
        this.op = op;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        RuleCdcPO ruleCdcPO = (RuleCdcPO) o;
        return Objects.equals(source, ruleCdcPO.source) && Objects.equals(before, ruleCdcPO.before) && Objects.equals(after, ruleCdcPO.after) && Objects.equals(op, ruleCdcPO.op);
    }

    @Override
    public int hashCode() {
        return Objects.hash(source, before, after, op);
    }

    @Override
    public String toString() {
        return "RuleCdcPO{" +
                "cdcSource=" + source +
                ", before=" + before +
                ", after=" + after +
                ", op='" + op + '\'' +
                '}';
    }
}
